//
//  SettingViewController.m
//  DuBai
//
//  Created by darktm on 14-3-10.
//  Copyright (c) 2014年 darktm. All rights reserved.
//

#import "SettingViewController.h"

#import "SettingViewCell.h"

#import "HelpViewController.h"
#import "SuggestViewController.h"
#import "AboutUsViewController.h"
#import "ModifyPWDViewController.h"

@interface SettingViewController ()

@end

@implementation SettingViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    

    
}

#pragma mark - tableview delegate -

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    UIView *view =[[UIView alloc]init];
    view.backgroundColor = [UIColor clearColor];
    return view;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    //7 || 6
    return 7;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    SettingViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SettingViewCell" forIndexPath:indexPath];

    switch (indexPath.row) {
        case 0:
            //我的积分
            cell.title.text = @"使用帮助";
            break;
        case 1:
            //个人信息
            cell.title.text = @"意见反馈";
            break;
        case 2:
            //我的订单
            cell.title.text = @"版本检测";
            break;
        case 3:
            //收货地址
            cell.title.text = @"软件好评";
            break;
        case 4:
            cell.title.text = @"关于我们";
            break;
        case 5:
            cell.title.text = @"修改密码";
            break;
            
        case 6:
            cell.title.text = @"退出账户";
            break;
    }

    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    DLog(@"%d",indexPath.row);
    
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    switch (indexPath.row) {
        case 0:{
            HelpViewController *help = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"HelpViewController"];
            [self.navigationController pushViewController:help animated:YES];
        }
            break;
        case 1:{
            SuggestViewController *help = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"SuggestViewController"];
            [self.navigationController pushViewController:help animated:YES];
        }
            break;
        case 2:
//版本检测
            break;
        case 3:
//软件好评，跳转到appstore
            break;
        case 4:{
            AboutUsViewController *help = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"AboutUsViewController"];
            [self.navigationController pushViewController:help animated:YES];
        }

            break;
        case 5:
//            修改密码
        {
            ModifyPWDViewController *modify = [[ModifyPWDViewController alloc] initWithNibName:@"ModifyPWDViewController" bundle:nil];
            [self.navigationController pushViewController:modify animated:YES];
        }
            break;
        case 6:
//退出帐号
            break;
    }
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
